/***********的jquery左右循环滚动图片代码***************
** index首页已经使用
** groups首页已经使用
** pindao-youpin、mingpin首页已经使用
** 404.htm首页已经使用
*/
$(document).ready(function (){
   /*组货左右循环滚动图片*/
   $("#images_scroll").jCarouselLite({ 
		btnNext: ".scroll_next", 
		btnPrev: ".scroll_prev", 
		visible: 4,
		scroll: 4,
		auto: 3000,
		speed: 800
	});  
	  
	/* 新店展播 */
	$('#new_store_slide').each(function(){ 
		 $("#store_content").jCarouselLite({ visible:1, scroll:1, spend:1000, auto: 5000, start:0, btnGo:[".b1",".b2",".b3",".b4",".b5",".b6",".b7",".b8"],
			 afterEnd:function(a){
			   var selector = a.selector
			   var min = selector.indexOf("(")+1;
			   var max = selector.indexOf(")")-min;
			   var $eq = (selector.substr(min,max)-1);
			   if($eq > 7) $eq = 0;
			   $("#store_nav li").eq($eq).addClass("on").siblings().removeClass("on");
			   a.find('img').each(function(){
				  var src =$(this).attr('pf178_src');
				  if (src) $(this).attr("src",src).removeAttr("pf178_src");
			   });
		  }});
	});	
	$('.new_store_slide').each(function(){ 
		 $("#store_content").jCarouselLite({ visible:1, scroll:1, spend:1000, auto: 5000, start:0, btnGo:[".b1",".b2",".b3",".b4",".b5",".b6",".b7",".b8"],
			 afterEnd:function(a){
			   var selector = a.selector
			   var min = selector.indexOf("(")+1;
			   var max = selector.indexOf(")")-min;
			   var $eq = (selector.substr(min,max)-1);
			   if($eq > 7) $eq = 0;
			   $("#store_nav li").eq($eq).addClass("on").siblings().removeClass("on");
			   a.find('img').each(function(){
				  var src =$(this).attr('pf178_src');
				  if (src) $(this).attr("src",src).removeAttr("pf178_src");
			   });
		  }});
	});	
});

/*jcarousellite是一款jquery插件，可以控制文档元素滚动，丰富的参数设置可以控制滚动的更多细节，是一款不可多得的滚动插件，使用非常方便，目前支持jquery1.2和以上版本。*/
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,play:true,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;tLi.bind("mouseover",function(){if(o.auto){o.play=false;}});tLi.bind("mouseout",function(){if(o.auto){o.play=true;}});if(tLi.size()<=v){if(o.auto){return false;}}
if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).hover(function(){o.play=false;},function(){o.play=true;});if(o.btnNext)$(o.btnNext).hover(function(){o.play=false;},function(){o.play=true;});if(o.btnPrev)$(o.btnPrev).click(function(){return goto(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return goto(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return goto(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?goto(curr-o.scroll):goto(curr+o.scroll)});if(o.auto){setInterval(AutoPlay,o.auto+o.speed);};function AutoPlay(){if(o.play){goto(curr+o.scroll);}};function vis(){return f.slice(curr).slice(0,v)};function goto(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}
else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);
//参数说明
//btnPrev string上一个按钮的选择器,比如 btnPrev: ".prev"
//btnNext string下一个按钮的选择器,比如 btnNext: ".next"
//btnGo array自定义滚动位置,类似幻灯片效果置,有选项卡,按照数组顺序,依次为按钮1按钮2按钮N,如以下,class名为1的按钮是第一个按钮：[".1", ".2"] 
//mouseWheel bool鼠标滑是否可以轮控制上下滚动,可选：false,true,默认false
//auto int指定多少秒内容定期自动滚动。默认为空(null),是不滚动,如果设定的,单位为毫秒,如1秒为1000
//speed int滑动的速度,可以尝试800 1000 1500,设置成0将删除效果
//easing string缓冲效果名称,如：easing: "bounceout",需要jquery中的easing pluin（缓冲插件实现）,只适用于jq1.2
//vertical bool是否垂直滚动,可选：false,true,默认false
//circular bool是否循环滚动,默认为true,如果为false,滚动到最后一个将停止滚动
//visible int可见数量,可以为小数，如2.5为2.5个li
//start int开始的地方,默认是0
//scroll int每次滚动的li数量
//beforeStart func滚动开始时回调的函数,可以传入对象参数 beforeStart: function(a) { alert("开始的对象是:" + a)}
//afterEnd func 滚动结束时回调的函数,使用方法同上



/* jquery.jfade.js 鼠标经过时其他图片变暗
/* 鼠标经过时其他图片变暗 */
(function(){
	$.fn.jfade = function(settings) { var defaults = { start_opacity: "1", high_opacity: "1", low_opacity: ".6", timing: "100" };
	var settings = $.extend(defaults, settings);
	settings.element = $(this);
	$(settings.element).css("opacity",settings.start_opacity);//set opacity to start
	$(settings.element).hover(//mouse over
		function () {//mouse in	
			$(this).stop().animate({opacity: settings.high_opacity}, settings.timing); //100% opacity for hovered object
			$(this).siblings().stop().animate({opacity: settings.low_opacity}, settings.timing); //dimmed opacity for other objects
		},
		function () {//mouse out
			$(this).stop().animate({opacity: settings.start_opacity}, settings.timing); //return hovered object to start opacity
			$(this).siblings().stop().animate({opacity: settings.start_opacity}, settings.timing); // return other objects to start opacity
		}
	);
	return this;
	}
})(jQuery);

$().ready(function() {
   $('.adver_text').hover(function(){
	   $(this).css("background-color","#000000");
   });	
   $('.jfade_image').jfade();
}); 
